<?php

declare(strict_types=1);

namespace App\Request\User;

use Hyperf\Validation\Request\FormRequest;

class MemberListRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'limit' => 'required|numeric|min:1|max:200',
            'page' => 'required|numeric|min:1|max:200',
            'keywords' => 'nullable',
        ];
    }

    public function messages(): array
    {
        return [
            'limit.required' => '每页条数缺失',
            'page.required' => '页数缺失',
            'limit.numeric' => '请输入正确的数字',
            'limit.min' => '请输入正确的数字',
            'limit.max' => '请输入正确的数字',
            'page.numeric' => '请输入正确的数字',
            'page.min' => '请输入正确的数字',
            'page.max' => '请输入正确的数字',
        ];
    }
}
